1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package com.google.common.collect;
16
17 import com.google.common.annotations.GwtCompatible;
18
19 import junit.framework.TestCase;
20
21 import java.util.SortedSet;
22
23
24
25
26
27
28 @GwtCompatible
29 public class SortedIterablesTest extends TestCase {
30 public void testSameComparator() {
31 assertTrue(SortedIterables.hasSameComparator(Ordering.natural(), Sets.newTreeSet()));
32
33 if (Maps.newTreeMap().keySet() instanceof SortedSet) {
34 assertTrue(
35 SortedIterables.hasSameComparator(Ordering.natural(), Maps.newTreeMap().keySet()));
36 }
37 assertTrue(SortedIterables.hasSameComparator(Ordering.natural().reverse(),
38 Sets.newTreeSet(Ordering.natural().reverse())));
39 }
40
41 public void testComparator() {
42 assertEquals(Ordering.natural(), SortedIterables.comparator(Sets.newTreeSet()));
43 }
44 }